package com.willpower.eureka;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.Banner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

/**
 * @author: wen-yi;
 * @date: 2021/10/29 23:08;
 * @Description:
 * 主要加在控制类上面 EnableGlobalMethodSecurity
 * @Secured("ROLE_abc")
 * @PreAuthorize("hasRole('abc')")//可以加上ROLE_
 */
@EnableEurekaServer
@SpringBootApplication
@EnableSwagger2 //启动swagger2
@MapperScan("com.willpower.eureka.mapper") //读取mapper配置注解生成对象  或者在mapper文件上单独加Mapper
@EnableGlobalMethodSecurity(securedEnabled = true,prePostEnabled = true) //注解配置权限
public class EurekaApplication {
    public static void main(String[] args) {
        SpringApplication application = new SpringApplication(EurekaApplication.class);
        application.setBannerMode(Banner.Mode.OFF); //关闭Banner
        application.run(args);
        System.out.println("eureka security server start...");
    }
}
